#define _CRT_SECURE_NO_WARNINGS 1
#include <stdio.h>
int main()
{
    int n, c;
    int arr[50];
    int arr2[50];
    int j = 0;
    scanf("%d", &n);
    for (int i = 0; i < n; i++)
    {
        scanf("%d", &arr[i]);
    }
    scanf("%d", &c);
    for (int i = 0; i < n; i++)
    {
        if (arr[i] != c)
        {
            arr2[j] = arr[i];
            j++;
        }
    }
    for (int i = 0; i < j; i++)
    {
        printf("%d ", arr2[i]);
    }
    return 0;

}